from pytest import fixture
from msoffice.word import Application
from os.path import exists, abspath

@fixture
def app():
    app = Application()
    yield app
    app.Quit()


@fixture
def documents(app):
    return app.Documents

@fixture
def docx(documents):
    candidates = [
        'D:/Research/2.在研项目/目标识别/智能化任务书.docx',
        'FDA-MIMO回波数据处理-李思琦-20220114.docx'
    ]
    for filename in candidates:
        if exists(filename):
            return documents.Open(filename)
    return None

